[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fcloseall()             Close All Open Streams

 #include   <stdio.h>

 int        fcloseall(void);

    fcloseall() closes all open streams except 'stdin' and 'stdout' after
    flushing all buffers associated with the streams.  When the streams
    are closed, system-allocated buffers are automatically freed, but
    those assigned with setbuf() and setvbuf() are not.


       Returns:     The total number of streams successfully closed.  EOF
                    is returned on error.

   -------------------------------- Example ---------------------------------

    This example opens two streams and closes them both with a single
    call to fcloseall().

           #include <stdio.h>

           FILE *stream1, *stream2;

           main()
           {
               if ((stream1 = fopen("ch1.txt","w+")) != NULL &&
                   (stream2 = fopen("ch2.txt","w+")) != NULL){
                   .
                   .
                   .
                   fcloseall();
               }
           }


See Also: fclose() close() setbuf() setvbuf()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson